<?php
class Admin_DownloadController extends Zend_Controller_Action
{
    protected $_flash;
    
    public function init()
    {
        $this->_flash = $this->_helper->getHelper('FlashMessenger');
    }
	public function indexAction()
	{
	    
	    
// 	    $zip = new ZipArchive();
// 	    $filename = '\files\documents\file.zip';
// 	    $oki_param =$zip->open($filename, ZIPARCHIVE::CREATE );
// 	    echo $oki_param;
// 		if ($zip->open($filename, ZIPARCHIVE::CREATE )!==TRUE) {
// 		}
// 	    $zip->addFile('\files\documents\career\career_1_cv.doc');
// 	    $zip->addFile('\files\documents\career\career_1_app.doc');
// 	    echo "numfiles: " . $zip->numFiles . "\n";
// 	    echo "status:" . $zip->status . "\n";
// 	    echo filesize('\files\documents\file.zip');
// 	    $zip->close();
// 	    die;

		$filename = $this->_getParam('filename', 0);
		$dir = PUBLIC_PATH.'\files\documents\career\\'.$filename;
		
	    header('Content-Type: application/msword');
	    header('Content-disposition: attachment; filename='.$filename);
	    header('Content-Length: ' . filesize($dir));
	    
	    readfile($dir);
	    
	    exit;
	}
	public function careerFileAction()
	{
	    $filename = $this->_getParam('filename', 0);
	    $dir = PUBLIC_PATH.'\files\documents\career\\'.$filename;
	    
	    header('Content-Type: application/msword');
	    header('Content-disposition: attachment; filename='.$filename);
	    header('Content-Length: ' . filesize($dir));
	     
	    readfile($dir);
	     
	    exit;
	}
}
?>